#include "donsee.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

int main()
{
	long t_nHandle = -99;
	int i = 0;
	char pszError[128];
	unsigned char Response[1024] = {0};
	long t_nRe;

	printf("********************************************************\n");
	printf("请输入数字选择需要测试的功能:\n");
	printf("0、测试蜂鸣器和版本号\n");
	printf("1、测试 身份证\n");
	printf("2、测试 社保卡\n");
	printf("3、测试 M1 卡\n");
	printf("4、测试 非接触CPU卡\n");
	printf("5、测试 银行卡\n");
	printf("6、测试 15693卡\n");
	printf("7、测试 接触CPU卡\n");
	printf("8、测试 磁条卡\n");
	printf("9、测试 4442卡\n");
	printf("10、测试 北京通卡\n");
	printf("11、关闭射频天线\n");
	printf("12、Donsee_iReadCardBas\n");
	printf("13、Donsee_iReadCardBas_HSM_Step1\n");
	printf("14、Donsee_iReadCardBas_HSM_Step2（需要自己写代码调用）\n");
	printf("********************************************************\n");

	int t_nIndex;
	scanf("%d", &t_nIndex);

	if (t_nIndex == 0) //测试版本号和蜂鸣器
	{
		t_nHandle = Donsee_Open("USB");
		if (t_nHandle != 0)
		{
			printf("连接读卡器失败，t_nRe = %ld\n", t_nHandle);
			return -1;
		}
		t_nRe = Donsee_Version(Response);
		printf("设备版本号:%s\n", Response);
		Donsee_Beep();
		Donsee_Close();
	}

	if (t_nIndex == 1) //测试身份证
	{
		t_nHandle = Donsee_Open("USB");
		if (t_nHandle != 0)
		{
			printf("连接读卡器失败，t_nRe = %ld\n", t_nHandle);
			return -1;
		}
		memset(Response, 0, 1024);
		// t_nRe = Donsee_ReadIDCardUid(Response);   //身份证Uid，有需要的可以这里获取
		// printf("Donsee_ReadIDCardUid返回:%s\n", Response);

		IDINFO idInfo;
		char t_arrMsg[256];

		// nType [in]:设置身份证读卡类型：0，文本信息；1，文本+照片；2，文本+照片+指纹
		// nMode [in]:设置读卡模式：0，读卡1次、拿开后放上重读；1，连续读卡，此功能未实现，填1就行
		int nType = 1;
		int nMode = 1; //此功能未实现，填1就行
		memset(&idInfo, 0, sizeof(IDINFO));
		char t_szPath[256] = "IDPhoto.bmp";
		// char t_szPath[256] = "";
		// char t_szPath[256] = NULL;

		t_nRe = Donsee_ReadIDCard(nType, nMode, t_szPath, &idInfo, t_arrMsg);
		if (t_nRe != 0)
		{
			printf("读身份证失败\n");
			Donsee_Close();
			return -2;
		}
		else
		{
			Donsee_Beep();
			// Donsee_Beep(t_nHandle, 0x16);
			printf("读身份证成功\n");
			if (
				strcmp(idInfo.certType, "Y") == 0)
			{
				printf(("中文姓名：%s\n"), idInfo.name);
				printf(("性    别：%s\n"), idInfo.sex);
				printf(("换证次数：%s\n"), idInfo.changCount);
				printf(("出身日期：%s\n"), idInfo.birthday);
				printf(("英文姓名：%s\n"), idInfo.ENfullname);
				printf(("永久居住证号：%s\n"), idInfo.number);
				printf(("有效期开始：%s\n"), idInfo.signdate);
				printf(("有效期结束：%s\n"), idInfo.validterm);
				printf(("英文姓名(备用)：%s\n"), idInfo.ENfullnameOther);
				printf(("国籍代码：%s/%s\n"), idInfo.Nationality,idInfo.people);
				printf(("证件标识：%s\n"), idInfo.certType);
				printf(("既往关联码：%s\n"), idInfo.oldNumber);
			}
			else if (strcmp(idInfo.certType, "I") == 0)
			{
				printf(("英文姓名：%s\n"), idInfo.ENfullname);
				printf(("性    别：%s\n"), idInfo.sex);
				printf(("永久居住证号：%s\n"), idInfo.number);
				printf(("国籍代码：%s\n"), idInfo.Nationality);
				printf(("中文姓名：%s\n"), idInfo.name);
				printf(("有效期开始：%s\n"), idInfo.signdate);
				printf(("有效期结束：%s\n"), idInfo.validterm);
				printf(("出身日期：%s\n"), idInfo.birthday);
				printf(("证件版本：%s\n"), idInfo.certVersion);
				printf(("初次受理机关：%s\n"), idInfo.organs);
				printf(("证件标识：%s\n"), idInfo.certType);
			}
			else if (strcmp(idInfo.certType, "J") == 0)
			{
				printf(("姓    名：%s\n"), idInfo.name);
				printf(("性    别：%s\n"), idInfo.sex);
				printf(("出身日期：%s\n"), idInfo.birthday);
				printf(("住    址：%s\n"), idInfo.address);
				printf(("公民身份证号：%s\n"), idInfo.number);
				printf(("签发机关：%s\n"), idInfo.organs);
				printf(("有效期开始：%s\n"), idInfo.signdate);
				printf(("有效期结束：%s\n"), idInfo.validterm);
				printf(("通行证号：%s\n"), idInfo.passNu);
				printf(("签发数次：%s\n"), idInfo.signCount);
				printf(("证件标识：%s\n"), idInfo.certType);
			}
			else// if (strcmp(idInfo.certType, "0") == 0)
			{
				printf(("姓    名：%s\n"), idInfo.name);
				printf(("性    别：%s\n"), idInfo.sex);
				printf(("民    族：%s\n"), idInfo.people);
				printf(("出身日期：%s\n"), idInfo.birthday);
				printf(("住    址：%s\n"), idInfo.address);
				printf(("公民身份证号：%s\n"), idInfo.number);
				printf(("签发机关：%s\n"), idInfo.organs);
				printf(("有效期开始：%s\n"), idInfo.signdate);
				printf(("有效期结束：%s\n"), idInfo.validterm);
				printf(("证件标识：%s\n"), idInfo.certType);
			}

			// printf(("1024相片原始数据:%s\n"), idInfo.Photo);

			Donsee_Close();
		}
	}

	if (t_nIndex == 2) //测试社保卡，三代社保卡需要Psam秘钥才能读取，二代卡不需要（只能插卡读取）
	{
		t_nHandle = Donsee_Open("USB");
		if (t_nHandle != 0)
		{
			printf("连接读卡器失败，t_nRe = %ld\n", t_nHandle);
			return -1;
		}
		SSCard_IDINFO cardInfo;
		memset(&cardInfo, 0, sizeof(cardInfo));

		long t_nRead = Donsee_ReadSSCard(0x11, &cardInfo, pszError);
		if (t_nRead != 0)
		{
			printf("读社保卡失败,MSG:%s\n", pszError);
			Donsee_Close();
			return -2;
		}
		else
		{
			Donsee_Beep(t_nHandle, 0x16);
			printf("读社保卡成功\n");
			printf("姓名:%s\n", cardInfo.name);
			printf("性别:%s\n", cardInfo.sex);
			printf("民族:%s\n", cardInfo.nation);
			printf("出生日期:%s\n", cardInfo.birthday);
			printf("发证日期:%s\n", cardInfo.signdate);
			printf("有效日期:%s\n", cardInfo.validterm);
			printf("卡号:%s\n", cardInfo.cardnumber);
			printf("社会保障号码(身份证号):%s\n", cardInfo.idnumber);
			printf("城市代码:%s\n", cardInfo.city);
			printf("社保卡版本:%s\n", cardInfo.cardveVrsion);
			Donsee_Close();
		}
	}

	if (t_nIndex == 3) //测试M1卡
	{
		t_nHandle = Donsee_Open("USB");
		if (t_nHandle != 0)
		{
			printf("连接读卡器失败，t_nRe = %ld\n", t_nHandle);
			return -1;
		}
		char t_chMsgM1[256] = "";
		// t_nRe = Donsee_ReadICUid(t_chMsgM1);  //功能未实现
		// if (t_nRe == 0)
		//{
		//	printf("M1 卡 获取UID成功,UID:%s\n", t_chMsgM1);
		// }

		// M1寻卡
		t_nRe = Donsee_ICRequest();
		if (t_nRe != 0)
		{
			printf("M1 卡片请求 失败，返回值:%ld\n", t_nRe);
		}
		t_nRe = Donsee_ICAnticoll(t_chMsgM1); //防碰撞可以出来uid，M1和cpu卡都支持
		if (t_nRe != 0)
		{
			printf("M1 卡片防碰撞 失败，返回值:%ld\n", t_nRe);
		}

		t_nRe = Donsee_ICSelect(0x41);
		if (t_nRe != 0)
		{
			printf("TypeA 卡片选择 失败，返回值:%ld\n", t_nRe);
		}

		printf("M1 寻卡成功");
		printf("M1 卡 获取UID成功,UID:%s\n", t_chMsgM1);

		int t_nKeyMode = 0x60; // KeyA
		int t_nAdd = 5;
		t_nRe = Donsee_M1VerifyPass(t_nKeyMode, t_nAdd / 4, "FFFFFFFFFFFF");
		if (t_nRe != 0)
		{
			printf("M1 卡片 Donsee_M1VerifyPass 密钥认证 失败，返回值:%ld", t_nRe);
		}
		else
			printf("M1 卡 Donsee_M1VerifyPass 密钥认证 成功\n");

		unsigned char t_chKey[6] = {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF};
		t_nRe = Donsee_M1VerifyPassHex(t_nKeyMode, t_nAdd / 4, t_chKey);
		if (t_nRe != 0)
		{
			printf("M1 卡片 Donsee_M1VerifyPassHex 密钥认证 失败，返回值:%ld", t_nRe);
		}
		else
			printf("M1 卡 Donsee_M1VerifyPassHex 密钥认证 成功\n");

		char t_pszReadData[128] = "";
		t_nRe = Donsee_M1Read(t_nAdd, t_pszReadData);
		if (t_nRe != 0)
		{
			printf("M1 卡片读卡 失败，返回值:%ld\n", t_nRe);
		}
		else
			printf("M1 卡 读取第 %d 块数据 成功,Data:%s\n", t_nAdd, t_pszReadData);

		t_nRe = Donsee_M1Write(t_nAdd, "0102030405060708090001020304050A");
		if (t_nRe != 0)
		{
			printf("M1 卡片写卡 失败，返回值:%ld\n", t_nRe);
		}
		else
			printf("M1 卡 写入第 %d 块数据: 0102030405060708090001020304050A, 成功\n", t_nAdd);

		memset(t_pszReadData, 0, 128);
		t_nRe = Donsee_M1Read(t_nAdd, t_pszReadData);
		if (t_nRe != 0)
		{
			printf("M1 卡片读卡 失败，返回值:%ld\n", t_nRe);
		}
		else
			printf("M1 卡 读取第 %d 块数据 成功,Data:%s\n", t_nAdd, t_pszReadData);

		unsigned long t_nValue = 256;

		t_nRe = Donsee_M1Initval(t_nAdd, t_nValue);
		if (t_nRe != 0)
		{
			printf("M1 卡片初始化值 失败，返回值:%ld\n", t_nRe);
		}
		else
			printf("M1 卡 卡片初始化第 %d 块 值  成功\n", t_nAdd);

		t_nRe = Donsee_M1Increment(t_nAdd, 100);
		if (t_nRe != 0)
		{
			printf("M1 卡片增值 失败，返回值:%ld\n", t_nRe);
		}
		else
			printf("M1 卡 卡片增值 第 %d 块  成功\n", t_nAdd);

		t_nRe = Donsee_M1Decrement(t_nAdd, 20);
		if (t_nRe != 0)
		{
			printf("M1 卡片减值 失败，返回值:%ld\n", t_nRe);
		}
		else
			printf("M1 卡 卡片减值第 %d 块 成功\n", t_nAdd);

		t_nRe = Donsee_M1Readval(t_nAdd, &t_nValue);
		if (t_nRe != 0)
		{
			printf("M1 卡片读值 失败，返回值:%ld\n", t_nRe);
		}
		else
			printf("M1 卡 卡片读值 %d 块   成功,Value = %ld\n", t_nAdd, t_nValue);

		t_nRe = Donsee_M1LoadKey(t_nKeyMode, t_nAdd / 4, "FFFFFFFFFFFF");
		if (t_nRe != 0)
		{
			printf("M1 卡片加载密钥 失败，返回值:%ld\n", t_nRe);
		}
		else
			printf("M1 卡 卡片加载到密钥 第%d扇区   成功\n", t_nAdd / 4);

		t_nRe = Donsee_M1Verify(t_nKeyMode, t_nAdd / 4);
		if (t_nRe != 0)
		{
			printf("M1 卡片认证加载密钥 第%d扇区 失败，返回值:%ld\n", t_nAdd / 4, t_nRe);
		}
		else
			printf("M1 卡 卡片认证加载密钥 第%d扇区   成功\n", t_nAdd / 4);

		Donsee_Beep(t_nHandle, 0x16);
		Donsee_Close();
	}

	if (t_nIndex == 4) //测试非接触式CPU卡
	{
		t_nHandle = Donsee_Open("USB");
		if (t_nHandle != 0)
		{
			printf("连接读卡器失败，t_nRe = %ld\n", t_nHandle);
			return -1;
		}
		char t_arrDataRe[32] = {0};
		char t_arrDataUID[8] = {0};

		long t_nSet = Donsee_SetTypeA();
		if (t_nSet != 0)
		{
			printf("TypeA 设置失败\n");
			Donsee_Close();
			return -1;
		}

		long t_nReq = Donsee_ICRequest();
		if (t_nReq != 0)
		{
			printf("TypeA 请求失败\n");
			Donsee_Close();
			return 1;
		}

		long t_nAtl = Donsee_ICAnticoll(t_arrDataUID);
		if (t_nAtl != 0)
		{
			printf("TypeA 防碰撞失败\n");
			Donsee_Close();
			return 1;
		}

		printf("TypeA_Anticoll:%s\n", t_arrDataUID);

		long t_nSel = Donsee_ICSelect(0x41);
		if (t_nSel != 0)
		{
			printf("TypeA 选卡失败\n");
			Donsee_Close();
			return 1;
		}

		t_nRe = Donsee_PowerOnTypeA(t_arrDataRe);
		if (t_nRe != 0)
		{
			printf("TypeA 上电失败");
			Donsee_Close();
			return 1;
		}

		printf("TypeA_ATR:%s\n", t_arrDataRe);

		memset(Response, 0, 1024);
		printf("TypeA-APDU发送:0084000008\n");
		t_nRe = Donsee_APDUType("0084000008", Response);
		if (t_nRe != 0)
		{
			printf("TypeA 上电失败");
			Donsee_Close();
			return 1;
		}
		printf("TypeA-APDU返回:%s\n", Response);
		Donsee_Beep(t_nHandle, 0x16);
		Donsee_Close();
	}
	if (t_nIndex == 5) //测试银行卡
	{
		t_nHandle = Donsee_Open("USB");
		if (t_nHandle != 0)
		{
			printf("连接读卡器失败，t_nRe = %ld\n", t_nHandle);
			return -1;
		}
		char t_szBankNo[256] = "";
		char *p, *q;
		unsigned char tmp;
		t_nRe = Donsee_GetBankCardNo(t_szBankNo);
		if (t_nRe != 0)
			printf("读取银行卡号失败\n");
		else
		{
			tmp = (unsigned char)(strchr(t_szBankNo, 'D') - t_szBankNo);
			q = (tmp > 0) ? strndup(t_szBankNo, tmp) : strdup(t_szBankNo);
			printf("读取银行卡号成功：%s\n", q);
			Donsee_Beep(t_nHandle, 0x16);
		}
		Donsee_Close();
	}

	if (t_nIndex == 6) //测试15693卡
	{
		t_nHandle = Donsee_Open("USB");
		if (t_nHandle != 0)
		{
			printf("连接读卡器失败，t_nRe = %ld\n", t_nHandle);
			return -1;
		}
		char t_chMsg15693[256] = "";
		t_nRe = Donsee_15693_Find(t_chMsg15693);
		if (t_nRe != 0)
		{
			printf("15693 寻卡失败，返回值:%ld\n", t_nRe);
		}
		else
			printf("15693 寻卡成功，UID:%s\n", t_chMsg15693);

		t_nRe = Donsee_15693_Info(t_chMsg15693);
		if (t_nRe != 0)
		{
			printf("15693 卡信息获取失败，返回值:%ld\n", t_nRe);
		}
		else
			printf("15693 卡信息获取成功，CardInfo:%s\n", t_chMsg15693);

		unsigned char t_nBlkAdd = 0x00;
		memset(t_chMsg15693, 0, 256);
		t_nRe = Donsee_15693_Read(t_nBlkAdd, t_chMsg15693);
		if (t_nRe != 0)
		{
			printf("15693 卡读卡失败，返回值:%ld\n", t_nRe);
		}
		else
			printf("15693 卡读卡成功，Data:%s\n", t_chMsg15693);

		t_nRe = Donsee_15693_Write(t_nBlkAdd, "88898685");
		if (t_nRe != 0)
		{
			printf("15693 卡写卡失败，返回值:%ld\n", t_nRe);
		}
		else
			printf("15693 卡写卡成功，Data:88898685\n");

		memset(t_chMsg15693, 0, 256);
		t_nRe = Donsee_15693_Read(t_nBlkAdd, t_chMsg15693);
		if (t_nRe != 0)
		{
			printf("15693 卡读卡失败，返回值:%ld\n", t_nRe);
		}
		else
			printf("15693 卡读卡成功，Data:%s\n", t_chMsg15693);
		Donsee_Beep(t_nHandle, 0x16);
		Donsee_Close();
	}

	if (t_nIndex == 7) //测试接触式CPU卡
	{
		t_nHandle = Donsee_Open("USB");
		if (t_nHandle != 0)
		{
			printf("连接读卡器失败，t_nRe = %ld\n", t_nHandle);
			return -1;
		}
		memset(Response, 0, 1024);
		t_nRe = Donsee_ColdPowerOn(0x01, Response);
		printf("cpu冷复位:%s\n", Response);

		memset(Response, 0, 1024);
		t_nRe = Donsee_HotPowerOn(0x01, Response);
		printf("cpu热复位:%s\n", Response);

		memset(Response, 0, 1024);
		t_nRe = Donsee_PowerOn(0x01, Response);
		printf("cpu复位:%s\n", Response);

		memset(Response, 0, 1024);
		printf("cpu-APDU发送:0084000008\n");
		t_nRe = Donsee_APDU(0x01, "0084000008", Response);
		printf("cpu-APDU返回:%s\n", Response);
		Donsee_Beep(t_nHandle, 0x16);
		Donsee_Close();
	}

	if (t_nIndex == 8) //测试磁条卡
	{
		t_nHandle = Donsee_Open("USB");
		if (t_nHandle != 0)
		{
			printf("连接读卡器失败，t_nRe = %ld\n", t_nHandle);
			return -1;
		}
		unsigned char t_nTime = 15;
		int t_nTrack = 2;
		char t_pszTrackData[512] = "";
		t_nRe = Donsee_ReadMagCard(t_nTime, t_nTrack, t_pszTrackData);
		if (t_nRe != 0)
		{
			printf("磁条卡刷卡失败，返回值:%ld\n", t_nRe);
		}
		else
			printf("磁条卡刷卡成功，TrackData:%s\n", t_pszTrackData);

		//设置主动输出
		unsigned char szConfig[3] = {0x02, 0x00, 0x01};
		// t_nRe = Donsee_ReadMagType(0x00,szConfig) ;
		// if (t_nRe != 0)
		// 	printf("磁条卡设置主动输出失败，返回值:%ld\n", t_nRe);
		// else
		// 	printf("磁条卡设置主动输出成功\n");

		//设置被动输出
		// t_nRe = Donsee_ReadMagType(0x01,szConfig) ;
		// if (t_nRe != 0)
		// 	printf("磁条卡设置被动输出失败，返回值:%ld\n", t_nRe);
		// else
		// 	printf("磁条卡设置被动输出成功\n");
		Donsee_Beep(t_nHandle, 0x16);
		Donsee_Close();
	}

	if (t_nIndex == 9) //测试4442卡
	{
		t_nHandle = Donsee_Open("USB");
		if (t_nHandle != 0)
		{
			printf("连接读卡器失败，t_nRe = %ld\n", t_nHandle);
			return -1;
		}
		char t_chMsg4442[256] = "";

		t_nRe = Donsee_4442_PowerOn(t_chMsg4442);
		if (t_nRe == 0)
		{
			printf("4442 卡 上电成功,UID:%s\n", t_chMsg4442);
		}

		int t_nCount;
		t_nRe = Donsee_4442_ReadCount(&t_nCount);
		if (t_nRe == 0)
		{
			printf("4442 卡 密钥认证剩余次数:%d次\n", t_nCount);
		}

		memset(t_chMsg4442, 0, 256);
		t_nRe = Donsee_4442_Read(32, 16, t_chMsg4442);
		if (t_nRe == 0)
		{
			printf("4442 卡 读卡成功,Data:%s\n", t_chMsg4442);
		}

		t_nRe = Donsee_4442_Verify("FFFFFF");
		if (t_nRe == 0)
		{
			printf("4442 卡 密钥认证成功\n");
		}

		t_nRe = Donsee_4442_Write(32, 16, "AAAAAAAAAABBBBBBBBBBCCCCCCCCCCDD");
		if (t_nRe == 0)
		{
			printf("4442 卡 写卡成功,Data:AAAAAAAAAABBBBBBBBBBCCCCCCCCCCDD\n");
		}

		t_nRe = Donsee_4442_Read(32, 16, t_chMsg4442);
		if (t_nRe == 0)
		{
			printf("4442 卡 读卡成功,Data:%s\n", t_chMsg4442);
		}

		t_nRe = Donsee_4442_WriteProtect(0, 16, "AAAAAAAAAABBBBBBBBBBCCCCCCCCCCDD");
		if (t_nRe == 0)
		{
			printf("4442 卡 写卡保护成功,Data:AAAAAAAAAABBBBBBBBBBCCCCCCCCCCDD\n");
		}

		t_nRe = Donsee_4442_ReadProtect(0, 16, t_chMsg4442);
		if (t_nRe == 0)
		{
			printf("4442 卡 读卡保护成功,Data:%s\n", t_chMsg4442);
		}

		t_nRe = Donsee_4442_PowerOff();
		if (t_nRe == 0)
		{
			printf("4442 卡 下电成功\n");
		}
		Donsee_Beep(t_nHandle, 0x16);
		Donsee_Close();
	}

	if (t_nIndex == 10) //测试北京通卡
	{
		t_nHandle = Donsee_Open("USB");
		if (t_nHandle != 0)
		{
			printf("连接读卡器失败，t_nRe = %ld\n", t_nHandle);
			return -1;
		}
		BJT_IDINFO idInfo;
		char t_arrMsg[256];

		memset(&idInfo, 0, sizeof(BJT_IDINFO));
		t_nRe = Donsee_ReadBJTIDCard(&idInfo, t_arrMsg);
		if (t_nRe != 0)
		{
			printf("读取北京通失败\n");
			Donsee_Close();
			return -2;
		}
		else
			Donsee_Beep(t_nHandle, 0x16);
		printf("读取北京通成功\n");
		printf(("姓名：%s\n"), idInfo.name);
		printf(("性 别：%s\n"), idInfo.sex);
		printf(("北京通号：%s\n"), idInfo.cardnumber);
		printf(("卡片类型:%s\n"), idInfo.nType);
		printf(("证件名称:%s\n"), idInfo.cardName);
		printf(("发卡机构:%s\n"), idInfo.organs);

		t_nRe = Donsee_ReadBJTIDCard_Photo("./bjt.jpg", t_arrMsg);
		if (t_nRe != 0)
		{
			printf("读取北京通头像失败\n");
			Donsee_Close();
			return -2;
		}
		else
			printf("读取北京通头像成功\n");
		Donsee_Close();
	}

	if (t_nIndex == 11) //关闭射频天线
	{
		t_nHandle = Donsee_Open("USB");
		if (t_nHandle != 0)
		{
			printf("连接读卡器失败，t_nRe = %ld\n", t_nHandle);
			return -1;
		}
		Donsee_SwitchRF(0); // 0 关闭天线，1 打开天线
		Donsee_Close();
	}

	if (t_nIndex == 12) //测试Donsee_iReadCardBas
	{

		char t_pszMsg[1024] = "";
		unsigned char tmp;
		t_nRe = Donsee_iReadCardBas(3,t_pszMsg);
		if (t_nRe != 0)
			printf("Donsee_iReadCardBas 获取数据 失败\n");
		else
		{
			printf("Donsee_iReadCardBas 获取数据 成功：\n%s\n", t_pszMsg);
			
		}
		// Donsee_Close();
	}

	if (t_nIndex == 13) //测试step1
	{

		char t_pszMsg[1024] = "";
		unsigned char tmp;
		t_nRe = Donsee_iReadCardBas_HSM_Step1(3,t_pszMsg);
		if (t_nRe != 0)
			printf("iReadCardBas_HSM_Step1 获取数据 失败\n");
		else
		{
			printf("iReadCardBas_HSM_Step1 获取数据 成功：\n%s\n", t_pszMsg);
			
		}
		// Donsee_Close();
	}

}
